package com.elinkway.infinitemovies.async;


import android.content.Context;

import com.elinkway.infinitemovies.bean.Lottery;
import com.elinkway.infinitemovies.http.api.MoviesHttpApi;
import com.elinkway.infinitemovies.http.parser.LotteryParser;
import com.lvideo.http.bean.LVideoDataHull;

public class RequestLotteryTask extends MoviesHttpAsyncTask<Lottery> {
	private RequestResultListener <Lottery> mListener;
    public RequestLotteryTask(Context context) {
        super(context);
    }

    public void setParams() {

    }

    @Override
	public LVideoDataHull<Lottery> doInBackground() {
        return MoviesHttpApi.requestSpreadInfo(new LotteryParser());
    }

	@Override
	public void onPostExecute(int updateId, Lottery result) {
		if(null != mListener) {
			mListener.onRequestSuccess(updateId, result);
			
		}
	}

	public RequestResultListener <Lottery> getListener() {
		return mListener;
	}

	@Override
	public void netNull() {
		super.netNull();
		if(null != mListener) {
			mListener.onRequestFailed();
		}
	}

	@Override
	public void netErr(int updateId, String errMsg) {
		super.netErr(updateId, errMsg);
		if(null != mListener) {
			mListener.onRequestFailed();
		}
	}

	@Override
	public void dataNull(int updateId, String errMsg) {
		super.dataNull(updateId, errMsg);
		if(null != mListener) {
			mListener.onRequestFailed();
		}
	}

	public void setListener(RequestResultListener <Lottery> mListener) {
		this.mListener = mListener;
	}

}
